package com.example.lunch;

import com.example.service.CountService;
import com.example.service.LockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @ClassName AppLunch
 * @Description
 * @Author Jingxiao.Ye
 * @Date 2022/1/20 上午12:10
 * @Version V1.0
 * @Since JDK 11
 */
@Component
public class AppLunch implements ApplicationRunner {

    @Autowired
    private LockService lockService;
    @Autowired
    private CountService countService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        /*String key = "app_lock_p";
        String token = null;
        while (( token = lockService.lock(key,10)) == null);
        System.out.println("执行业务");
        lockService.unlock(key,token);*/
        countService.count();
    }
}
